﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace ExpLib.SSO
{
    public class SSOAuthenticateHttpModule : IHttpModule
    {

        public void Dispose()
        {

        }

        public void Init(HttpApplication context)
        {
            context.AuthenticateRequest += new EventHandler(context_AuthenticateRequest);
            context.BeginRequest += new EventHandler(context_BeginRequest);


        }

        void context_BeginRequest(object sender, EventArgs e)
        {
            HttpApplication application = (HttpApplication)sender;

            HttpContext context = application.Context;
            HttpResponse Response = context.Response;
            Response.AddHeader("PP", "CP=CAO PSA OUR");//加上这个,防止在Iframe的时间Cookie丢失
        }



        void context_AuthenticateRequest(object sender, EventArgs e)
        {

            HttpApplication application = (HttpApplication)sender;

            HttpContext context = application.Context;

            HttpRequest Request = context.Request;
            HttpResponse Response = context.Response;

            if (Request.IsAuthenticated)
            {
                return;
            }
            else
            { 
                
            }

        }

    }
}
